#!/usr/local/bin/python2.4
# -*- coding: UTF-8 -*-
# visualisering club mezcla
# vj krute 2007

from vj import *
from LSystemGL import *
from pOSC import *

class MainScene(Scene):

	### DONT PUT GL STUFF HERE!!!#
	def __init__(self):
		Scene.__init__(self)
		self.size = 0
				
	## USE THIS INSTEAD ##
	def init(self):
		Scene.init(self)
		self.object = LSystemGL(uniform(0.6,2),uniform(-0.4,0.5))
	#	self.text = TTFBillboard("mezcla", "../fonts/times.ttf", 20, 1024)
		self.bg = BridgeBillboard("../images/tummensvartvitstor.png")
		
	def OSCParser(self, message):
		Scene.OSCParser(self,message)
		self.size += 0.1
		
	def idle(self):
		Scene.idle(self)
		self.size = self.size*0.9;
		self.object.update(self.size)
		self.object.compute()
		
		self.bg.height= self.size
		self.bg.offset= self.rtri/60.0
		self.bg.softness = 0.35
		
	def display(self):
		Scene.display(self)
		
		glLoadIdentity()
		glTranslatef(-0.5,-0.5,-0.4)
		glColor4f(0.3,0.3,0.3,0.4)
	#	glScalef(self.size, self.size, self.size)
		glDisable(GL_DEPTH_TEST)
		glEnable(GL_BLEND)
	
		glPushMatrix()
		for i in range(-10,10):
			glPushMatrix()
			glTranslatef(i,0,0)
			self.bg.draw()
			glPopMatrix()
		glPopMatrix()
		self.object.draw()

		
		glutSwapBuffers()
		

if __name__=="__main__":

	s=MainScene()
	launchConsole()
	s.main(sys.argv)
